<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<jsp:include page="../../common/ListUIHead.jsp"></jsp:include>
	<title>数据选择器</title>
</head>
<body style="padding:1px 3px 1px 3px;overflow:hidden">
	<div id="main">
		<div position="center">
    		<form onsubmit="searchData();return false;">	
				<div id="toolBar">
					<div class="l-toolbar-item l-panel-btn">
		    			<input type="text" name="searchKeyWord" onfocus="if(this.value==this.defaultValue){this.value='';}" onblur="if(this.value==''){this.value=this.defaultValue;}" title="名称" defaultValue="名称" value="名称" id="searchKeyWord" />
					</div>
				</div>
    		</form>
			<div id="tableContainer">
			</div>
	    </div>
    </div>
</body>
</html>
<script type="text/javascript">
	$(document).ready(function(){
		$("#main").ligerLayout({});
		tb = $("#toolBar").ligerToolBar({
			items:[{id:'add',text:'查询',click:searchData,icon:'search2'}]
			});
		$list_dataGrid = $("#tableContainer").ligerGrid($.extend($list_defaultGridParam,{
            columns: [ 
				<c:forEach items="${query.columns }" var="column" varStatus="status">
				{display: '${column.display }', name: '${column.field }', align: '${column.align }', width: ${column.width }<c:if test="${column.hidden }">,hide:true</c:if>}
				<c:if test="${!status.last }">,</c:if>
				</c:forEach>
	        ],
            url:getPath()+'/framework/dataPicker/listData',
            parms:{query:'${query.id}'<c:if test="${!empty param }"><c:forEach items="${param }" var="item">,${item.key }:'${item.value}'</c:forEach></c:if>},
            onDblClickRow:function(){
            	okSelect();
            }
        }));
		$list_dataParam['query'] = '${query.id}';
		<c:if test="${!empty param }">
			<c:forEach items="${param }" var="item">
				$list_dataParam['${item.key }'] = '${item.value}';
			</c:forEach>
		</c:if>
	});
	function okSelect(){
		var selects = $list_dataGrid.getSelected();
		if(selects==null || selects.length==0){
			artDialog.alert('请选择数据');
		}else{
			artDialog.open.origin[art.dialog.data("returnFunName")].call(null, selects);
			art.dialog.close();
		}
	}
</script>